#include"process.h"
#include<unistd.h>
#include<string.h>
#include<stdio.h>

typedef void(*callback_t)(double total,double current);

double total = 1024.0;
double speed = 1.0;

void DownLoad(callback_t cb)
{
    double current = 0;
    while(current <= total)
    {
        cb(total,current);
        current += speed;
        usleep(5000);
    }
    printf("\nDownload %.2lfMB\n",total);
}

void UpLoad(callback_t cb)
{
    double current = 0;
    while(current <= total)
    {
        cb(total,current);
        current += speed;
        usleep(5000);
    }
    printf("\nUpload %.2lfMB\n",total);
}

int main()
{
    DownLoad(FlushProcess);
    UpLoad(FlushProcess);
    return 0;
}
